package com.ruoyi.walmart.domain.shipments.dto;

import lombok.Data;

import java.util.Objects;

@Data
public class SkuGtinKey {

    private String sku;
    private String gtin;

    public SkuGtinKey(String sku, String gtin) {
        this.sku = sku;
        this.gtin = gtin;
    }

    // 重写equals和hashCode是关键，用于Map的key比较
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SkuGtinKey that = (SkuGtinKey) o;
        return Objects.equals(sku, that.sku) && Objects.equals(gtin, that.gtin);
    }

    @Override
    public int hashCode() {
        return Objects.hash(sku, gtin);
    }

    @Override
    public String toString() {
        return sku + "|" + gtin;
    }
}
